import {config, request} from 'utils'

const { api } = config
const { chatroom, chatroomChatRecords } = api

export function query(params) {
  return request({
    url: chatroom,
    method: 'get',
    data: params,
  })
}

export function stat() {
  return request({
    url: chatroom + '/stat',
    method: 'get',
  })
}

export function queryChatroomChatRecords(params) {
  return request({
    url: chatroomChatRecords + '/list',
    method: 'get',
    data: params
  })
}

export function queryById(params) {
  return request({
    url: chatroom + '/findOne',
    method: 'get',
    data: params,
  })
}

export function remove(params) {
  return request({
    url: chatroom + '/delete',
    method: 'post',
    data: params,
  })
}

export function create(params) {
  return request({
    url: chatroom,
    method: 'post',
    data: params,
  })
}

export function update(params) {
  return request({
    url: chatroom,
    method: 'put',
    data: params,
  })
}
